#ifndef SKILL_H
#define SKILL_H


#include "dtwentycore_global.h"


#include <modelitemset.h>
#include <modelitem.h>


class Description;


class DTWENTYCORESHARED_EXPORT Skill : public ModelItem
{
    Q_OBJECT

    Q_PROPERTY(int keyAbility READ keyAbility WRITE setKeyAbility NOTIFY keyAbilityChanged)
    Q_PROPERTY(bool tryAgain READ tryAgain WRITE setTryAgain NOTIFY tryAgainChanged)
    Q_PROPERTY(QString tryAgainDescription READ tryAgainDescription WRITE setTryAgainDescription NOTIFY tryAgainDescriptionChanged STORED false)
    Q_PROPERTY(bool useUntrained READ useUntrained WRITE setUseUntrained NOTIFY useUntrainedChanged)
    Q_PROPERTY(QString useUntrainedDescription READ useUntrainedDescription WRITE setUseUntrainedDescription NOTIFY useUntrainedDescriptionChanged STORED false)
    Q_PROPERTY(bool armorCheckPenalty READ armorCheckPenalty WRITE setArmorCheckPenalty NOTIFY armorCheckPenaltyChanged)
    Q_PROPERTY(int action READ action WRITE setAction NOTIFY actionChanged)

    Q_PROPERTY(QString check READ check WRITE setCheck NOTIFY checkChanged STORED false)
    Q_PROPERTY(QString special READ special WRITE setSpecial NOTIFY specialChanged STORED false)
    Q_PROPERTY(QString restrictions READ restrictions WRITE setRestrictions NOTIFY restrictionsChanged STORED false)


    int m_keyAbility;
    bool m_tryAgain;
    QString m_tryAgainDesc;

    bool m_useUntrained;
    QString m_useUntrainedDesc;

    bool m_armorCheckPenalty;

    int m_action;


public:

    Q_INVOKABLE Skill(QObject *parent = 0);
    Skill(const Skill& other);

    int keyAbility() const;
    bool tryAgain() const;
    bool useUntrained() const;
    bool armorCheckPenalty() const;

    int action() const;
    Q_INVOKABLE void addSkillSynergy(Skill* skill);

    QString check() const;
    QString special() const;
    QString restrictions() const;


    QString tryAgainDescription() const;

    QString useUntrainedDescription() const;

signals:

    void keyAbilityChanged(int arg);
    void tryAgainChanged(bool arg);
    void useUntrainedChanged(bool arg);
    void armorCheckPenaltyChanged(bool arg);

    void actionChanged(int arg);
    void checkChanged(QString arg);
    void specialChanged(QString arg);
    void restrictionsChanged(QString arg);


    void tryAgainDescriptionChanged(QString arg);

    void useUntrainedDescriptionChanged(QString arg);

public slots:

    void setKeyAbility(int arg);
    void setTryAgain(bool arg);
    void setUseUntrained(bool arg);
    void setArmorCheckPenalty(bool arg);
    void setAction(int arg);

    Q_INVOKABLE void setCheck(QString arg);
    Q_INVOKABLE void setSpecial(QString arg);
    Q_INVOKABLE void setRestrictions(QString arg);
    Q_INVOKABLE void setTryAgainDescription(QString arg);
    Q_INVOKABLE void setUseUntrainedDescription(QString arg);


protected:

    Description *findDescription(QString name) const;


};



Q_DECLARE_METATYPE(Skill)


class DTWENTYCORESHARED_EXPORT Skills : public ModelItemSet<Skill>
{
    Q_OBJECT

public:

    Q_INVOKABLE Skills(QObject* parent = 0) :
        ModelItemSet<Skill>(parent)
    {
        setName("Skills");
    }

    Skills(const Skills& other) :
        ModelItemSet<Skill>(other)
    {
    }

};

Q_DECLARE_METATYPE(Skills)



#endif // SKILL_H

